

<body>

    <div class="hd">
        <div class="warp">
            <ul class="btn-list">
                <li class="item">

                    <a href="<?php echo $base_url?>home/order/shoppingcar" class="shop-car bg">
                        <!--<div class="num">1</div>-->
                        <i class="icon iconfont icon-icon"></i>
                    </a>
                </li>
                <li  class="item">
                     <!--<a href="./register.html">
                        <i class="iconfont icon-wode"></i>请登录
                    </a>-->
                    <?php if(isset($user)){?>
                    <span href="#" class="bg">
                        <i class="icon iconfont icon-wode"></i><?php echo $user->mobile;?>
                    </span>
                    
                    <ul class="child-item">
                            <li><a href="<?php echo $base_url?>home/order/userorders">我的订单</a></li>
                            <li><a href="<?php echo $base_url?>home/address">收货地址</a></li>
                            <li><a href="<?php echo $base_url;?><?php if(!empty($cardid)){echo 'home/card/cardlist';}else{echo 'home/card/addcard';}?>">绑定银行卡</a></li>
                            <li><a href="<?php echo $base_url?>home/account/logout">退出商城</a></li>
                    </ul>
                    <?php }else{?>
                    <a href="<?php echo $base_url?>home/account/login?back_url=<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>">
                        <i class="iconfont icon-wode"></i>请登录
                    </a>
                    <?php }?>
                </li>
            </ul>
            <a href="<?php echo $base_url?>home/goods/index">
            <img src="<?php echo $base_url?>static/dist/images/logo.png" alt="" class="logo-img">
             <span class="span_txt">商城首页</span>
            </a>
        </div>
    </div>


    <div class="order_details">
        <div class="warp">
            <p class="tit">订单详情</p>

            <!--<p class="pd-20"></p>-->
            <div class="order_item">
                <div class="order_tit">
                    <p class="r">
                        <span class="dfk">
                            <?php if($data['status'] == 4): ?>
                                支付超时
                            <?php elseif($data['status']==2): ?>
                                <!--交易成功-->
								已发货
                            <?php elseif ($data['status']==1) :?>
								待发货
                            <?php endif; ?>
                        </span>
                    </p>
                    <p class="msg">
                       <span class="order_num">订单号：<?php echo $data['order_id']; ?></span> 
                       <span class="time"><?php echo date('Y-m-d H:i:s', $data['create_time']); ?></span>
                    </p>
                </div>
                <div class="order_msg">
                    <?php if(!empty($data['logistics'])):?>
					<p class="msg"> 
						<span class="msg_tit">
						物流单号：
						</span>
						<?php echo $data['express']?>：<?php echo $data['logistics']?>
                    </p>
                    <?php endif;?>
                    <p class="msg"> 
                    <span class="msg_tit">
                    收货地址：
                    </span>
                    <?php echo $data['username']; ?>；  <?php echo $data['mobile']; ?>；  <?php echo $data['address']; ?>
                    </p>
                    <p class="remarks-txt">
                        <span>买家备注：</span>
						<span class="txt_bz">
							<?php echo $data['leave']; ?>
						</span>
                        <!--<input type="text" placeholder="选填，对本次交易订单的说明" value="<?php echo $data['leave']; ?>" readonly>-->
                    </p>

                </div>
                <div class="order_warp">
                    <div class="l_order_box">
                        <ul>
                            <?php foreach($data['detail'] as $goods_id => $detail): ?>
                            <li class="order_child_item">
								<div class="l_num">
                                    <p class="num_txt">数量：×<?php echo $detail['amount']?></p>
                                </div>
                                <div class="l_price">
                                    <p class="price_txt">单价:¥<?php echo $detail['price']?></p>
                                </div>
                                <div class="l_img">
                                    <img src="<?php echo $detail['img_path']?>" alt="">
                                </div>
                                <div class="l_msg">
                                    <p class="name"><?php echo $detail['goods_name']?></p>
                                    <p class="msg"><?php echo $detail['other_name']?></p>
                                    <p class="qy"><i class="iconfont icon-lingchengben"></i><?php echo $detail['activity_desc']; ?></p>
                                </div>
                                <div class="l_sku">
                                    <!-- <p class="sku_txt">颜色分类：黄色；</p> -->
                                </div>
								
                                
                            </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>
                    <div class="r_order_box">
                        <div class="msg_box">
                            <p>
                            <span class="msg_tit">支付方式：</span> 
                            <?php if($data['status'] == 4): ?>
                                未支付   
                            <?php elseif($data['paytype'] == 1 || $data['paytype'] == 2): ?>
                                微信
                            <?php elseif($data['paytype'] == 3): ?>
                                支付宝
                            <?php endif; ?>
                            </p>
                            <p><span class="msg_tit">配送方式：</span>       快递免邮</p>
                            <p><span class="msg_tit">应付：</span>            <span class="price">¥<?php echo $data['price']; ?></span> </p>
                        </div>
                    </div>
                </div>
            </div>


            <div class="pd-200"></div>
        </div>


    </div>
    <?php $this->load->view('home/pc/comm'); ?>
    <script src="<?php echo $base_url?>static/dist/js/lib/jquery.min.js"></script>
    <!--<script src="<?php echo $base_url?>static/dist/js/lib/store.legacy.min.js"></script>-->
    <script>
        //初始化购物车
        // var cartData = store.get('cartData') || [];
		var cartData = getCookie('cartData') || [];

        if(cartData.length != 0){           
                fillCart();             
        }
        //计算购物车商品总数量
        function fillCart() {
            var htmlStr = '';
            var sum = 0, num = 0;
            for (var i = 0; i < cartData.length; i++) {
                num = parseInt(cartData[i].quantity) || 0;
                if (num) {
                    sum += num;
                }
            }
            if (sum >= 100) {
                sum = '99+'
            }
			if(sum == 0){
					 $('.shop-car').find('.num').addClass('none');
					 
					 return;
				}
            htmlStr = '<div class="num">' + sum + '</div>';
            $numEl = $('.shop-car .num');
            if ($numEl.length == 0) {
                $('.shop-car').append(htmlStr)
            } else {
                $numEl.html(sum)
            }
        }
		 function getCookie(cname) {
			var name = cname + "=";
			var ca = document.cookie.split(';');
			for(var i=0; i<ca.length; i++) {
				var c = ca[i];
				while (c.charAt(0)==' ') c = c.substring(1);
				if (c.indexOf(name) != -1){
					return JSON.parse(c.substring(name.length, c.length));
				} 
			}
			return "";
		}
    </script>
</body>

</html>
